#pragma once

//trust inputs
#pragma warning( disable : 4996)

#include <math.h>
#include <time.h>
#include <stdio.h>
#include <fstream>
#include <sstream>
#include <string>
#include "GL/glut.h"

#include "subdivision_util.h"
#include "Surface.h"
#include "Eigenstructure.h"

using namespace std;

class User {
private:
    int w, h;

    int mouseButton;
    double lastMouseX, lastMouseY, diffMouseX, diffMouseY;
    double eyeDist, eyePhi, eyeTheta;

    GLenum polygonMode;
    bool drawNormals;
    bool hideBackface;
    bool useMeanCurvature;

    int NMax;
    Eigenstructure* eigenstructures;
    Surface* surface;

    clock_t lastFrame;
public:
    ofstream logfile;

    void init(int argc, char* argv[]);
    
    //config file
    void useConfigFile(const char* filename);

    void op_s(ifstream& configfile);
    void op_cc(ifstream& configfile);
    void op_ccLimit(ifstream& configfile);
    void op_obj(ifstream& configfile);
    void op_opt(ifstream& configfile);

    void setPerspective() const;
    
    //glut callins
    void render();
    void reshape(int w, int h);
    void keyboard(unsigned char key, int x, int y);
    void mouseState(int button, int state, int x, int y);
    void mouseMotion(int x, int y);
};
